package pl.wr.particle.impl.matter.composite.hadrons.baryons.nucleons;

import pl.wr.particle.def.matter.IParticle;
import pl.wr.particle.def.matter.composite.hadrons.baryons.nucleons.INeutron;
import pl.wr.particle.def.matter.elementary.fermions.leptons.IElectronNeutrino;
import pl.wr.particle.def.matter.elementary.fermions.quarks.IDown;
import pl.wr.particle.def.matter.elementary.fermions.quarks.IUp;
import pl.wr.particle.impl.Particle;
import pl.wr.particle.impl.matter.elementary.fermions.leptons.Electron;
import pl.wr.particle.impl.matter.elementary.fermions.leptons.ElectronNeutrino;
import pl.wr.particle.impl.matter.elementary.fermions.quarks.Down;
import pl.wr.particle.impl.matter.elementary.fermions.quarks.Up;

/**
 * @version 1.0
 * @author wieslaw.rodak
 *
 */
public class Neutron extends Particle implements INeutron {

	public static final String SYMBOL = "n";
	public static final String NAME = "neutron";
	private static final IParticle[] SELF = {new Up(), new Down(), new Down()};

	public Neutron() {
		super(SELF);
		SELF[0].setParentParticle(this);
		SELF[1].setParentParticle(this);
		SELF[2].setParentParticle(this);
	}
	
	public Neutron(IUp up1, IUp up2, IDown down) {
		super(up1, up2, down);
		up1.setParentParticle(this);
		up2.setParentParticle(this);
		down.setParentParticle(this);
	}

	@Override
	public IParticle[] fusion(IParticle[] particles) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public IParticle[] decay() {

		this.removeFromSpace();
		
		carringParticles = new Particle[3];
		
		carringParticles[0] = new Proton();
		carringParticles[0] = new Neutron(new Up(), new Up(), new Down());
		carringParticles[0].addToSpace();
		carringParticles[1] = new Electron();
		carringParticles[1].addToSpace();
		final IElectronNeutrino neutrino = new ElectronNeutrino();
		neutrino.getProperties().setAntiParticle(true);
		carringParticles[2] = neutrino;
		carringParticles[2].addToSpace();
		
		return carringParticles;
	}

	@Override
	public String toString() {
		return SYMBOL;
	}

}
